
#ifndef SYSTEMPUBLIC_H
#define SYSTEMPUBLIC_H

#include "threadPool.h"
#include "jsonTool.h"
#include "logManage.h"
#include "utilsTools.h"


//Socket
#include <arpa/inet.h>
//#include <json/json.h>          //new version
#include <sys/time.h>           //  for function ->  gettimeofday(&tval, NULL);

#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/shm.h>
#include<errno.h>
#include <typeinfo> //判断变量类型
#include <exception> //标准异常捕捉类

#include <pthread.h>
#include <mutex>
#include <map>

#include <boost/format.hpp> //没有则安装libboost-all-dev，apt-get install libboost-all-dev
#ifndef BoostCodeLocal
#define BoostCodeLocal (boost::format("file:%s, line:%d, function:%s\n>>>  ")% __FILE__ % __LINE__ % __FUNCTION__).str()   // return string, 带有 "\n"
// #define BoostCodeLocal (boost::format("file:%s\n>>>  ")% __FILE__).str()   // return string, 带有 "\n"
#endif


/**
 * @param poolPtr 线程池指针
*/
struct PlatformParams{
    bool debug = false;
    string logPath = "../log/";   //"../log/"
    ThreadPool *poolPtr=NULL;  // NULL
    int port = -1;
    string ip = "null";
    int queue = 0;
    int helloBeatBuffSize = 300;
    int hearBeatBuffSize = 200;
    int workBeatBuffSize = 2048;
    bool openDynamicImageCache = false;   //当传输的图像大于预设的图像缓存，小于最大设置缓存时，是否启用动态缓存接收图像，true接收


    string sysJsonFilePath = "../config/";   //"../config/"
    string tcpJsonFilePath = "";        //  握手，心跳包等
    map<string,string>* userMapPtr = NULL;  //准许连接的用户
};

#ifndef PublicClass
#define PublicClass
extern PlatformParams* ParamsPtr;
extern LOGGER_::Loger* LogerPtr;
#endif

#endif  //SYSTEMPUBLIC_H 